const express = require("express");
const router = express.Router();
var app = null;
router.get("/", async function (req, res, next) {
  // xxx.insert(app.db,{})
  console.time('test')
  const client = await app.locals.pool.connect();

  const ret = await client.query("select * from users");
  let data = ret.rows;

  client.release();
  console.log(data);
  console.timeEnd('test')
  res.render("index", { title: "hello" ,users:data});
});

module.exports = function (a) {
  app = a;
  return router;
};
